package com.ls.spring;

import com.ls.spring.bean.Hello;
import com.ls.spring.config.HelloConfig;
import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class HelloTes1 {
    /**
     * 注解配置测试
     */
    @Test
    public void test(){
        AnnotationConfigApplicationContext annotionCxt =
                new AnnotationConfigApplicationContext(HelloConfig.class);

        Hello hello = annotionCxt.getBean(Hello.class);
        hello.sayHello();

        Hello hello1 = (Hello) annotionCxt.getBean("hello");
        hello1.sayHello();

        Hello hello2 = (Hello) annotionCxt.getBean("hello1");
        hello2.sayHello();
    }
}
